package com.lebang.model.enums.buss;

/**
 * 任务状态
 * @className SessionStatus
 * @author weizx  
 * @date 2018年6月27日 上午11:52:25
 */
public enum TaskStatus {
    /***/
	None("暂无记录", 0),
	WaitSumbit("等待提交", 1),
	WaitCheckout("等待审核", 2),
	CheckSuccess("任务成功", 3),
	CheckFailure("任务失败", 4),
	HasReleased("任务已被释放", 5),
	redo("任务重做",6);


	
	private String title;
	private int index;
	
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

	private TaskStatus(String title, int
			index) {
		this.title = title;
		this.index = index;
	}
	
	public static TaskStatus getByIndex(int index) {
		for (TaskStatus e : TaskStatus.values()) {
			if (e.index == index) {
				return e;
			}
		}
		return null;
	}
	
	public static TaskStatus getByTitle(String title) {
		if (null == title) {
			return null;
		}
		for (TaskStatus e : TaskStatus.values()) {
			if (e.title.equals(title)) {
				return e;
			}
		}
		return null;
	}
}
